const CompressionPlugin = require('compression-webpack-plugin')

module.exports = {
  devServer: {
    port: 80,
    https: false,
    open: false,
    proxy: {
      ['/api']: {
        target: `http://127.0.0.1:8081`,
        changeOrigin: true,
        pathRewrite: {
          ['^' + '/api']: ''
        }
      },
      // ['/dify-api']: {
      //   target: `http://10.12.23.169:8085`,
      //   changeOrigin: true,
      //   pathRewrite: {
      //     ['^' + process.env.VUE_APP_BASE_API]: process.env.VUE_APP_BASE_API
      //   }
      // },
      ['websocket']: {
        target: `http://10.12.23.169:8085`,
        changeOrigin: true,
        pathRewrite: {
          ['^' + process.env.VUE_APP_BASE_API]: process.env.VUE_APP_BASE_API

        }
      }
    },
  },
  lintOnSave: false,
  productionSourceMap: false,
  configureWebpack: {
    plugins: [
      new CompressionPlugin({
        algorithm: 'gzip',
        test: /\.js$|\.html$|\.css$/,
        filename: '[path].gz[query]',
        minRatio: 1,
        threshold: 10240,
        deleteOriginalAssets: false
      })
    ]
  }
}
